#include <windows.h>
#include <stdio.h>

#include "afxwin.h"


CWnd::CWnd()
{
    m_hWnd = NULL;
}

BOOL CWnd::ShowWindow( int nCmdShow )
{
    ::ShowWindow( m_hWnd, nCmdShow );
}

void CWnd::UpdateWindow()
{
    ::UpdateWindow( m_hWnd );
}

BOOL CWnd::Create( LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext )
{
	fprintf(stderr, "debug: CWnd(0x%08X)::Create()\n", this);

	HINSTANCE hInstance = ::AfxGetInstanceHandle();

	// pParentWnd.m_hWnd
	m_hWnd = ::CreateWindow( lpszClassName, lpszWindowName, dwStyle, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, pParentWnd != NULL ? pParentWnd->m_hWnd : NULL, NULL, NULL, (VOID *)pContext );

	::SetProp( m_hWnd, "MyClassPointer", reinterpret_cast<HANDLE>(this) );

	return TRUE;
}

LRESULT CWnd::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	fprintf(stderr, "debug: CWnd(0x%08X)::WindowProc( 0x%08X, 0x%08X, 0x%08X )\n", this, message, wParam, lParam);

}
